import App from './App'
// #ifndef VUE3
import Vue from 'vue'
// 导入vuex
import store from './store/store.js'
import { $http } from '@escook/request-miniprogram'
// 配置请求根路径
$http.baseUrl = "https://api-hmugo-web.itheima.net"
//请求之前加loading
import uView from 'uview-ui'
Vue.use(uView)
import 'uview-ui/theme.scss';
// 如此配置即可
uni.$u.config.unit = 'rpx'
$http.beforeRequest = (options) => {
	uni.showLoading({
		title:'数据加载中...'
	})
}
// 请求完成之后，取消loading
$http.afterRequest = (options) => {
	uni.hideLoading()
}
uni.$http = $http

// 封装 uni.$showMsg() 方法
uni.$showMsg = (title="数据加载失败！",duration = 1500) =>{
	uni.showToast({
		title,
		duration,
		icon:'none'
	})
}
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
    ...App,
	// 2. 将 store 挂载到 Vue 实例上
	store
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif